<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>所有授权</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<?php
include_once( 'config.php' );

/*人人配置文件*/
include_once ('renren2.0/rennclient/RennClient.php');
$rennClient = new RennClient ( RENREN_APP_KEY, RENREN_APP_SECRET );
$rennClient->setDebug ( DEBUG_MODE );
$state = uniqid ( 'renren_', true );
$_SESSION ['renren_state'] = $state;
$renren_code_url = $rennClient->getAuthorizeURL ( RENREN_CALLBACK_URL,'read_user_status publish_comment','code', $state);

/*微博配置文件*/
include_once( 'saetv2.ex.class.php' );
$o = new SaeTOAuthV2( WB_AKEY , WB_SKEY );
$code_url = $o->getAuthorizeURL( WB_CALLBACK_URL );
$con=mysql_connect(DB_HOST,DB_USER,DB_PASSWORD); 
mysql_select_db(DB_NAME,$con);
mysql_query("SET NAMES utf8");
echo "<br/><br/><table class='mytable' cellpadding='0' cellspacing='0' border='0' style='width:1200px;padding:5px;word-break:break-all'><tr><td width='10%'>ID</td><td width='10%'>昵称</td><td  width='50%'>token</td><td width='15%'>过期时间</td><td width='15%'>授权</td></tr>";
$sql3="select * from cai_uid order by expires"; 
$result3=mysql_query($sql3);
while($row3=mysql_fetch_array($result3)){
    if($row3[4] == 'renren'){
        $img_src = 'img/rr.png';
        $href= $renren_code_url;
    }elseif($row3[4] == 'weibo'){
        $img_src = 'img/weibo.png';
        $href = $code_url;
    }elseif($row3[4] == 'qqweibo'){
        $img_src = 'img/qq_weibo.png';
        $href = 'qqweibo/demo.php';
    }
    echo '<tr><td>'.$row3[1].'</td><td>'.$row3[3].'</td><td>'.$row3[2].'</td><td>'.date("Y-m-d H:i:s", $row3[5]).'</td><td><a href='.$href.'><img src='.$img_src.'></a></td></tr>';
}
echo "</table>";
echo "<br/>MENGLECHONG.NET<br/><table class='mytable' cellpadding='0' cellspacing='0' border='0' style='width:1200px;padding:5px'><tr><td width='10%'>ID</td><td width='10%'>昵称</td><td  width='50%'>token</td><td width='15%'>过期时间</td><td width='15%'>授权</td></tr>";
$sql4="select * from cai_uid  where domain='menglechong.net' order by expires"; 
$result4=mysql_query($sql4);
while($row4=mysql_fetch_array($result4)){
    if($row4[4] == 'renren'){
        $img_src = 'img/rr.png';
        $href= 'https://graph.renren.com/oauth/authorize?client_id='.($config->APPID).'&response_type=code&scope='.($config->scope).'&state=a%3d1%26b%3d2&redirect_uri='.($config->redirecturi).'&x_renew=true';
    }elseif($row4[4] == 'weibo'){
        $img_src = 'img/weibo.png';
        $href = $code_url;
    }elseif($row4[4] == 'qqweibo'){
        $img_src = 'img/qq_weibo.png';
        $href = 'qqweibo/demo.php';
    }
    echo '<tr><td>'.$row4[1].'</td><td>'.$row4[3].'</td><td>'.$row4[2].'</td><td>'.date("Y-m-d H:i:s", $row4[5]).'</td><td><a href='.$href.'><img src='.$img_src.'></a></td></tr>';
}
echo "</table>";

echo "<br/>ALIKANGKANG.COM<br/><table class='mytable' cellpadding='0' cellspacing='0' border='0' style='width:1200px;padding:5px'><tr><td width='10%'>ID</td><td width='10%'>昵称</td><td  width='50%'>token</td><td width='15%'>过期时间</td><td width='15%'>授权</td></tr>";
$sql5="select * from cai_uid where domain='alikangkang.com' order by expires"; 
$result5=mysql_query($sql5);
while($row5=mysql_fetch_array($result5)){
    if($row5[4] == 'renren'){
        $img_src = 'img/rr.png';
        $href= 'https://graph.renren.com/oauth/authorize?client_id='.($config->APPID).'&response_type=code&scope='.($config->scope).'&state=a%3d1%26b%3d2&redirect_uri='.($config->redirecturi).'&x_renew=true';
    }elseif($row5[4] == 'weibo'){
        $img_src = 'img/weibo.png';
        $href = $code_url;
    }elseif($row5[4] == 'qqweibo'){
        $img_src = 'img/qq_weibo.png';
        $href = 'qqweibo/demo.php';
    }
    echo '<tr><td>'.$row5[1].'</td><td>'.$row5[3].'</td><td>'.$row5[2].'</td><td>'.date("Y-m-d H:i:s", $row5[5]).'</td><td><a href='.$href.'><img src='.$img_src.'></a></td></tr>';
}
echo "</table>";
?>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">  
    $(".mytable").find("tr:odd").css("background-color", "#bbb");    
    </script>
</body>
</html>
